package com.googlecode.googlereaderofflineclient.testAuth;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

/**
 * http://habrahabr.ru/blogs/development/86846/ - c#
 * http://dklab.ru/chicken/nablas/57.html - php
 * @author gizatullinm
 *
 *
 *Maratische Twitter Reader
 *
 *Consumer key:FoNBRvt2F0Zscli49cCaQ
 *Consumer secret:BAFkrqQyyicuORqmgTeIubbBJDA9DQL1ohVh0f2k
 *Request token URL:http://twitter.com/oauth/request_token
 *Access token URL:http://twitter.com/oauth/access_token
 *Authorize URL:http://twitter.com/oauth/authorize
 *
 */
public class MainTwiterExample {

	public static void main(String[] args) {
		MainTwiterExample example = new MainTwiterExample();
		try {
			example.step1();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	private void step1() throws IOException {
		HttpClient httpclient = new DefaultHttpClient();
		HttpGet httpget = new HttpGet("http://twitter.com/oauth/request_token");
		HttpResponse response;
				response = httpclient.execute(httpget);
				HttpEntity entity = response.getEntity();
				if (entity != null) {
				    InputStream instream = entity.getContent();
				    BufferedReader br = new BufferedReader(new InputStreamReader(instream));
				    String temp = null;
				    while ((temp = br.readLine()) != null ) {
				    	System.out.println(temp);
				    }
				}
	}
}
